﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClassForWinForm
{
    public partial class Form6 : Form
    {
        public Form6()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("MessageBox常见用法1");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("MessageBox常见用法2","标题");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult dialog= MessageBox.Show("MessageBox常见用法3", "标题", MessageBoxButtons.OKCancel);
            if (dialog == DialogResult.OK)
            {
                MessageBox.Show("你选择了确定！");
            }
            else
            {
                MessageBox.Show("你选择了取消！");
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            MessageBox.Show("MessageBox常见用法4", "标题", MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            MessageBox.Show("MessageBox常见用法5", "标题", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            MessageBox.Show("MessageBox常见用法6", "标题", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 0, @"G:\MyFile\Test\笑林新记.txt"); ;
        }
    }
}
